package com.cjkj.applet.controller;

import com.cjkj.applet.service.TJ01ReportService;
import com.cjkj.common.core.web.domain.AjaxResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 睡眠监测垫健康报告
 */
@RestController
@RequestMapping("/mattress/report")
@Validated
public class HealthReportMattressController {

    @Resource
    private TJ01ReportService tj01ReportService;

    /**
     * 睡眠报告
     * @param visitNo 患者就诊号
     */
    @GetMapping("/sleep")
    public AjaxResult getSleepReport(@NotNull(message = "患者就诊号不能为空！") Long visitNo) {
        return tj01ReportService.getSleepReportList(visitNo);
    }

    /**
     * 心率
     * @param visitNo 患者就诊号
     */
    @GetMapping("/heart")
    public AjaxResult getHeartReport(@NotNull(message = "患者就诊号不能为空！") Long visitNo) {
        return tj01ReportService.getHeartReportList(visitNo);
    }

    /**
     * 呼吸率
     * @param visitNo 患者就诊号
     */
    @GetMapping("/breathe")
    public AjaxResult getBreatheReport(@NotNull(message = "患者就诊号不能为空！") Long visitNo) {
        return tj01ReportService.getBreatheReportList(visitNo);
    }

    /**
     * 血氧报告
     * @param visitNo 患者就诊号
     */
    @GetMapping("/spo2")
    public AjaxResult getSpo2Report(@NotNull(message = "患者就诊号不能为空！") Long visitNo) {
        return tj01ReportService.getSpo2ReportList(visitNo);
    }

    /**
     * 获取患者监测报告
     * @return
     */
    @GetMapping("getMattressReportData")
    public AjaxResult getMattressReportData(@NotBlank(message = "就诊号不能为空！") String visitNos,
                                            @NotBlank(message = "打印项目不能为空！") String reportItems,
                                            @NotBlank(message = "报告日期不能为空！") String reportDate) {
        return tj01ReportService.getTJ01ReportData(visitNos, reportItems, reportDate);
    }
}
